import { createApp } from 'vue'
import { createPinia } from 'pinia'
import Antd from 'ant-design-vue'
import App from './App.vue'
import router from './router'
import { useUserStore } from './stores/user'
import * as diagnostics from './utils/diagnostics'

// 导入 Ant Design Vue 4.x 的样式
import 'ant-design-vue/dist/reset.css'
import './styles/main.css'

// 扩展Window接口以支持diagnostics属性
declare global {
  interface Window {
    diagnostics: typeof diagnostics;
  }
}

const app = createApp(App)

app.use(createPinia())
app.use(router)
app.use(Antd)

// 初始化用户状态
const userStore = useUserStore()
userStore.checkLoginStatus()

// 在开发环境下添加诊断工具到window对象
if (import.meta.env.DEV) {
  window.diagnostics = diagnostics;
  console.log('诊断工具已就绪，尝试在控制台运行: diagnostics.showUserPermissionInfo()');
}

app.mount('#app') 